package com.hospital.view.TabManager;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;
import com.hospital.Entity.BaseCard;
import com.hospital.Entity.Card;
import com.hospital.activity.R;
import com.hospital.adapter.CardAdapter;
import com.hospital.adapter.TimelineAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by wangjun on 2015/6/10.
 */
public class ManagerTab02Fragment extends Fragment {

    private ListView mListView;
    private CardAdapter mAdapter;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.layout_main,container,false);
        mListView = (ListView) view.findViewById(R.id.m_listView);
        //   mProgressBar = (ProgressBar) view.findViewById(R.id.manager_list_pro);
        //   empty = (RelativeLayout) view.findViewById(R.id.empty_layout);
//        mListView.setDividerHeight(0);
//        timelineAdapter = new TimelineAdapter(this.getActivity(), getData());
//        mListView.setAdapter(timelineAdapter);
//
//
//        setContentView(R.layout.info_main);


        mAdapter=new CardAdapter(this.getActivity(),getItems());
        mListView.setAdapter(mAdapter);
        return view;
    }

    private List<Card> getItems(){
        List<Card> mCards=new ArrayList<Card>();
        //第一个卡片
        Card mCard=new Card(R.drawable.pic_a,"这是第一个头条信息");
        BaseCard mBaseCard1=new BaseCard(R.drawable.pic_b,"习近平接受班禅拜见 勉励其努力修行(图)");
        BaseCard mBaseCard2=new BaseCard(R.drawable.pic_c,"昂山素季将访北京上海云南 中国大使罕见送行");
        BaseCard mBaseCard3=new BaseCard(R.drawable.pic_d,"上海5千张\"内鬼车牌\"流出 揭秘垄断生意");
        mCard.AppendCard(mBaseCard1);
        mCard.AppendCard(mBaseCard2);
        mCard.AppendCard(mBaseCard3);
        //添加卡片
        mCards.add(mCard);

        //第二个卡片
        mCard=new Card(R.drawable.pic_a,"这是第二个头条信息");
        mBaseCard1=new BaseCard(R.drawable.pic_b,"河北殉职公安政委之子目睹母亲跳楼痛哭流涕");
        mBaseCard2=new BaseCard(R.drawable.pic_b,"吉林延边驻军击毙1名疑似非法越境人员");
        mBaseCard3=new BaseCard(R.drawable.pic_b,"女巨贪杨秀珠在美申请庇护 受审面部浮肿");
        mCard.AppendCard(mBaseCard1);
        mCard.AppendCard(mBaseCard2);
        mCard.AppendCard(mBaseCard3);
        //添加卡片
        mCards.add(mCard);

        //第三个卡片
        mCard=new Card(R.drawable.pic_a,"这是第三个头条信息");
        mBaseCard1=new BaseCard(R.drawable.pic_c,"陈云纪录片将播出 陈家第三代首亮相荧幕(图)");
        mBaseCard2=new BaseCard(R.drawable.pic_c,"中朝边境非法越境为何屡禁不绝 如何打击");
        mBaseCard3=new BaseCard(R.drawable.pic_c,"中国颁布新文件:民船战时可迅速转为军用(图)");
        mCard.AppendCard(mBaseCard1);
        mCard.AppendCard(mBaseCard2);
        mCard.AppendCard(mBaseCard3);
        //添加卡片
        mCards.add(mCard);


        //第四个卡片
        mCard=new Card(R.drawable.pic_a,"这是第四个头条信息");
        mBaseCard1=new BaseCard(R.drawable.pic_d,"江西高考替考点被曝出现大量弃考 官方回应");
        mBaseCard2=new BaseCard(R.drawable.pic_d,"毕节4名留守儿童疑喝药自杀 仅吃玉米面度日");
        mBaseCard3=new BaseCard(R.drawable.pic_d,"四川资阳男子杀哨兵夺枪 今日被枪决(图)");
        mCard.AppendCard(mBaseCard1);
        mCard.AppendCard(mBaseCard2);
        mCard.AppendCard(mBaseCard3);
        //添加卡片
        mCards.add(mCard);

        return mCards;
    }
    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        //  getData();
    }
}
